#include <stdio.h>
#include <stdlib.h>
#include "list.h" // 请不要删除，否则检查不通过

bool init_queue(LinkQueue *LQ) {
	*LQ = malloc(sizeof(LinkQueueNode));
    (*LQ) -> next = *LQ;
    return 1;
}

bool enter_queue(LinkQueue *LQ, ElemType x) {
    LinkQueueNode *tmp = malloc(sizeof(LinkQueueNode));
    tmp -> next = (*LQ) -> next;
    (*LQ) -> next = tmp;
    tmp -> data = x;
    *LQ = tmp;
    return 1;
}

bool leave_queue(LinkQueue *LQ, ElemType *x) {
    LinkQueueNode *head = (*LQ) -> next;
    if(head -> next == head) return 0;
    *x = head -> next -> data;
    if(head -> next == *LQ) *LQ = head;
    LinkQueueNode *tmp = head -> next;
    head -> next = head -> next -> next;
    free(tmp);
    return 1;
}